package dry.example.study;

import com.alibaba.fastjson.JSONObject;
import org.junit.Test;

import java.util.HashMap;
import java.util.TreeMap;

/**
 * @author zc
 */
public class KeepOrderTest {

    @Test
    public void run01() {
        TreeMap<String, String> map = new TreeMap<>();
        map.put("c", "3");
        map.put("b", "2");
        map.put("a", "1");
        String data = JSONObject.toJSONString(map);
        System.out.println(data);
    }

    @Test
    public void run02() {
        HashMap<String, String> map = new HashMap<>(16);
        map.put("c", "3");
        map.put("b", "2");
        map.put("a", "1");
        String data = JSONObject.toJSONString(map);
        System.out.println(data);
    }

}
